<?php $this->load->view('admin/' . $this->router->fetch_class() . '/_script'); ?>
<div class="tabs ui-tabs ui-widget ui-widget-content ui-corner-all">
  <ul class="tab-menu ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
    <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
      <a href="#user-details-tab">
        <span><?php echo $this->lang->line('label.' . $this->router->fetch_class() . '.account') ?></span>
      </a>
    </li>
    <li class="ui-state-default ui-corner-top">
      <a href="#user-provider-tab">
        <span><?php echo $this->lang->line('label.' . $this->router->fetch_class() . '.profile') ?></span>
      </a>
    </li>
  </ul>
  <!-- Content tab -->
  <div id="user-details-tab" class="form_inputs ui-tabs-panel ui-widget-content ui-corner-bottom">
    <fieldset>
      <ul>
        <li class="even">
          <label for="first_name">
            <?php echo $this->lang->line('label.user.first_name') ?>
          </label>
          <div class="input">
            <input type="text" id="first_name" name="first_name" 
                   value="<?php echo empty($obj['first_name']) ? '' : $obj['first_name'] ?>" >
          </div>
        </li>
        <li>
          <label for="last_name"><?php echo $this->lang->line('label.user.last_name') ?></label>
          <div class="input">
            <input type="text" id="last_name" value="<?php echo empty($obj['last_name']) ? '' : $obj['last_name'] ?>" name="last_name">
          </div>
        </li>
        <li>
          <label for="username"><?php echo $this->lang->line('label.user.username') ?> <span>*</span></label>
          <div class="input">
            <input type="text" id="username"
                   value="<?php echo empty($obj['username']) ? '' : $obj['username'] ?>" name="username">
          </div>
        </li>
        <li class="even">
          <label for="display_name"><?php echo $this->lang->line('label.user.display_name') ?></label>
          <div class="input">
            <input type="text" id="display_name" value="<?php echo empty($obj['display_name']) ? '' : $obj['display_name'] ?>" name="display_name">
          </div>
        </li>
        <li>
          <label for="group_id"><?php echo $this->lang->line('label.user.group') ?></label>
          <div class="input">
            <select id="group_id" name="group_id" class="chzn chzn-done" style="visibility: visible;">
              <option value="">
                <?php echo $this->lang->line('label.option.select') ?>
              </option>
              <?php
              $ref_objs = $this->group_model->get_all();
              foreach ($ref_objs as $group) {
                ?>
                <option value="<?php echo $group['id'] ?>"
                        <?php echo empty($obj['group_id']) || $obj['group_id'] != $group['id'] ? '' : 'selected="selected"' ?>>
                  <?php echo $this->group_model->to_string($group) ?></option>
              <?php } ?>
            </select>
          </div>
        </li>
        <li class="even">
          <label for="password"><?php echo $this->lang->line('label.user.password') ?><span>*</span></label>
          <div class="input">
            <input type="password" autocomplete="off"
                   id="password" value="" name="password">						
          </div>
        </li>
        <li class="even">
          <label for="confirm_pass"><?php echo $this->lang->line('label.user.confirm_pass') ?><span>*</span></label>
          <div class="input">
            <input type="password" autocomplete="off"
                   id="confirm_pass" value="" name="confirm_pass">						
          </div>
        </li>
        <li class="even">
          <label for="is_active"><?php echo $this->lang->line('label.user.is_active') ?></label>
          <div class="input">
            <input type="checkbox" id="is_active" value="1" name="is_active" <?php echo isset($obj['is_active']) && $obj['is_active'] ? 'checked="checked"' : '' ?>>
          </div>
        </li>
      </ul>
    </fieldset>
  </div>
  <div id="user-provider-tab" class="form_inputs ui-tabs-panel ui-widget-content ui-corner-bottom">
    <fieldset>
      <ul>        
        <li>
          <label for="email"><?php echo $this->lang->line('label.provider_user.email') ?><span>*</span></label>
          <div class="input">
            <input type="text" id="email" value="<?php echo empty($obj["email"]) ? "" : $obj["email"] ?>" name="email">
          </div>
        </li>
        <li>
          <label for="phone"><?php echo $this->lang->line('label.provider_user.phone') ?><span>*</span></label>
          <div class="input"><input type="text" id="phone" value="<?php echo empty($obj["phone"]) ? "" : $obj["phone"] ?>" name="phone">
          </div>
        </li>
        <li>
          <label for="address"><?php echo $this->lang->line('label.provider_user.address') ?><span>*</span></label>
          <div class="input">
            <input type="text" id="address" value="<?php echo empty($obj["address"]) ? "" : $obj["address"] ?>" name="address">
          </div>
        </li>
        <li>
          <label for="status"><?php echo $this->lang->line('label.provider_user.status') ?></label>
          <div class="input">
            <select id="status" name="status" class="chzn chzn-done" style="visibility: visible;">
              <?php
              $status_array = array(
                  PROFILE_STATUS_BLOCK => $this->lang->line('label.profile.status.block'),
                  PROFILE_STATUS_ACTIVE => $this->lang->line('label.profile.status.active'),
                  PROFILE_STATUS_UNACTICE => $this->lang->line('label.profile.status.unactive'));
              foreach ($status_array as $value => $label) {
                ?>
                <option value="<?php echo $value ?>"
                        <?php echo empty($obj["status"]) || $obj["status"] != $value ? "" : 'selected="selected"' ?>>
                          <?php echo $label ?>
                </option>
              <?php } ?>
            </select>
          </div>
        </li>
        <li>
          <label for="country_id"><?php echo $this->lang->line('label.provider_user.country_id') ?><span>*</span></label>
          <div class="input">
            <select id="country_id" name="country_id" class="chzn chzn-done" style="visibility: visible;">
              <option value="0">
                <?php echo $this->lang->line('label.option.select') ?>
              </option>
              <?php
              $ref_objs = $this->country_model->get_all();
              foreach ($ref_objs as $ref) {
                ?>
                <option value="<?php echo $ref["id"] ?>"
                        <?php echo empty($obj["country_id"]) || $obj["country_id"] != $ref["id"] ? "" : 'selected="selected"' ?>>
                          <?php echo $this->country_model->to_string($ref) ?>
                </option>
              <?php } ?>
            </select>
          </div>
        </li>
        <li>
          <label for="state_id"><?php echo $this->lang->line('label.provider_user.state_id') ?><span>*</span></label>
          <div class="input">
            <select id="state_id" name="state_id" class="chzn chzn-done" style="visibility: visible;">
              <option value="0"><?php echo $this->lang->line('label.option.select') ?></option>
            </select>
          </div>
        </li>
        <li>
          <label for="city_id"><?php echo $this->lang->line('label.provider_user.city_id') ?><span>*</span></label>
          <div class="input">
            <select id="city_id" name="city_id" class="chzn chzn-done" style="visibility: visible;">
              <option value="0"><?php echo $this->lang->line('label.option.select') ?></option>
            </select>
          </div>
        </li>

        <li>
          <label for="company_name"><?php echo $this->lang->line('label.provider_user.company_name') ?></label>
          <div class="input"><input type="text" id="company_name" value="<?php echo empty($obj["company_name"]) ? "" : $obj["company_name"] ?>" name="company_name">
          </div>
        </li>
        <li>
          <label for="home_page"><?php echo $this->lang->line('label.provider_user.home_page') ?></label>
          <div class="input"><input type="text" id="home_page" value="<?php echo empty($obj["home_page"]) ? "" : $obj["home_page"] ?>" name="home_page">
          </div>
        </li>
        <li>
          <label for="fax"><?php echo $this->lang->line('label.provider_user.fax') ?></label>
          <div class="input"><input type="text" id="fax" value="<?php echo empty($obj["fax"]) ? "" : $obj["fax"] ?>" name="fax">
          </div>
        </li>
        <li>
          <label for="avatar">
            <?php echo $this->lang->line('label.provider_user.avatar') ?></label>
          <div class="input">
            <input type="file" id="avatar" name="avatar">
          </div>
        </li>
        <?php if (!empty($obj['avatar'])) { ?>
          <li>
            <label for="thumbnail">&nbsp;</label>
            <div class="input">
              <img width="200px" alt="avatar"
                   src="<?php echo site_url('admin/file_upload/get_img_from_path?path=' .
                $this->router->fetch_class() . '/' . $obj['avatar'])
          ?>" />
            </div>
          </li>
<?php } ?>
      </ul>
    </fieldset>
  </div>
</div>
